﻿package com.tudou.ad.components
{
    import com.tudou.ad.events.*;
    import com.tudou.skin.common.button.*;
    import com.tudou.skin.common.events.*;
    import com.tudou.utils.*;
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;

    public class AdVideoControlPanelBase extends Sprite
    {
        protected var adVolume:BaseButton;
        protected var timeTip:TextField;
        protected var _titleTpl:String = "广告倒计时 %s 秒";
        protected var skipBtn:InteractiveObject;

        public function AdVideoControlPanelBase()
        {
            return;
        }// end function

        public function set showVolume(param1:Boolean) : void
        {
            if (adVolume)
            {
                adVolume.visible = param1;
            }
            return;
        }// end function

        public function set titleTime(param1:Number) : void
        {
            if (timeTip)
            {
                timeTip.text = StringUtil.printf(_titleTpl, String(param1));
            }
            return;
        }// end function

        override public function set width(param1:Number) : void
        {
            return;
        }// end function

        public function clear() : void
        {
            return;
        }// end function

        protected function skipHlr(event:MouseEvent) : void
        {
            dispatchEvent(new AdVideoControlPanelEvent(AdVideoControlPanelEvent.SKIP));
            return;
        }// end function

        public function set volumeOn(param1:Boolean) : void
        {
            if (adVolume)
            {
                adVolume.activeIndex = param1 ? (0) : (1);
            }
            return;
        }// end function

        protected function volumeHlr(event:ButtonEvent) : void
        {
            if (event.clickIndex == 0)
            {
                dispatchEvent(new AdVideoControlPanelEvent(AdVideoControlPanelEvent.TURN_OFF));
            }
            else if (event.clickIndex == 1)
            {
                dispatchEvent(new AdVideoControlPanelEvent(AdVideoControlPanelEvent.TURN_ON));
            }
            return;
        }// end function

        public function set showSkip(param1:Boolean) : void
        {
            if (skipBtn)
            {
                skipBtn.visible = param1;
            }
            return;
        }// end function

    }
}
